<?php

Class Report{
	private $q;
	private $res;

	public function mod_pac_report($viejo_nrodoc,$viejo_tipdoc,$nrodoc,$tipdoc){

	$this->q = "UPDATE reports SET
		nro_doc_paciente = $nrodoc ,
		tipo_doc_paciente = '$tipdoc' 
		WHERE 
			nro_doc_paciente = $viejo_nrodoc AND
			tipo_doc_paciente  = '$viejo_tipdoc'";
	Database::query_baja($this->q);
	
	}
	

	public function id_report($nrodoc, $tipdoc){
		$this->q = "select id_report
			from reports r
			where r.tipo_doc_paciente = '$tipdoc'
			and r.nro_doc_paciente = $nrodoc";
		$res = Database::query_simple($this->q);
		return $res;
	}
	
	public function put_nuevo_report($nrodoc, $tipdoc, $id_enf){
		$this->q = "insert into reports (nro_doc_paciente, tipo_doc_paciente, id_enfermero)
				values ($nrodoc, '$tipdoc', $id_enf)";
		$res = Database::query_baja($this->q);

	}

	public function id_ultimo_report(){
		$this->q = "select id_report
			from reports
			order by id_report desc
			limit 1";

		$res = Database::query_simple($this->q);
		return $res;

	}
	
	
}?>
